use xiaohao_ar::dynamic_programming_ar::*;

// 1.
#[test]
fn climb_stairs_test() {
    assert_eq!(13, climb_stairs(6));
}

// 2.
#[test]
fn max_sub_array_test() {
    let v1 = vec![-2, 1, -3, 4, -1, 2, 1, -5, 4];
    assert_eq!(6, max_sub_array(v1));
}

// 3.
#[test]
fn length_of_list_test() {
    let v1 = vec![1, 9, 5, 9, 3];
    assert_eq!(3, length_of_list(v1));
    let v2 = vec![10, 9, 2, 5, 3, 7, 101, 18];
    assert_eq!(4, length_of_list(v2));
}

// 4.
#[test]
fn mini_mum_total_test() {
    let v1 = vec![
        vec![2, 0, 0, 0],
        vec![3, 4, 0, 0],
        vec![6, 5, 7, 0],
        vec![4, 1, 8, 3],
    ];
    assert_eq!(11, mini_mum_total(v1));
}
// 4.2
#[test]
fn min_path_sum_test() {
    let mut v1 = vec![
        vec![1, 3, 1],
        vec![1, 5, 1],
        vec![4, 2, 1]
    ];
    assert_eq!(7, min_path_sum(&mut v1));
}

// 5.
#[test]
fn rob_test() {
    let mut v1 = vec![1, 2, 3, 1];
    assert_eq!(4, rob(&mut v1));
    let mut v2 = vec![2, 7, 9, 3, 1];
    assert_eq!(12, rob(&mut v2));
}
